<?php
/**
 *  学校证照资质
 */

use yii\helpers\Html;
use common\widgets\DetailView;
use backend\models\School;

/* @var $this yii\web\View */
/* @var $model backend\models\School */
?>

<div style="margin-bottom: 10px">
    <?= Html::a('查看旧纪录', ['view', 'id' => $model->ID, 'flag' => 1], [
        'class' => 'btn btn-primary btn-sm',
        'style' => [
            'display' => $model->hasNoumenonRecord() && $model->ZT == '待审核' ? 'inline-block' : 'none',
        ]
    ]) ?>
    <?= Html::a('返回', ['view', 'id' => $model->ID, 'flag' => 0], [
        'class' => 'btn btn-success btn-sm',
        'style' => [
            'display' => $model->_hasShadowRecord() ? 'inline-block' : 'none',
        ]
    ]) ?>
</div>
<!-- <?php
echo '<pre>';
var_dump($model->hasOne(School::className(), ['ID' => 'XXID']));
echo '</pre>';
?> -->
<table class="table table-hover table-bordered">
    <tr>
        <th>序号</th>
        <th>证照资质名称</th>
        <th>证照资质类别</th>
        <th>获得时间</th>
        <th>登记时间</th>
        <th>影印文件</th>
    </tr>
    <?php 
    //if($model->schoolCertificates) 
        foreach($model->schoolCertificates as $cert){ 
            $idx++; 
    ?>
    <tr>
        <td><?= $idx ?></td>
        <td><?= Html::encode($cert->ZZMC) ?></td>
        <td><?= Html::encode($cert->ZZLB) ?></td>
        <td><?= Html::encode($cert->HDSJ) ?></td>
        <td><?= Html::encode($cert->DJSJ) ?></td>
        <td><?= Html::a(basename($cert->WJ), $_SERVER["REQUEST_SCHEME"].'://'.$_SERVER['HTTP_HOST'].$cert->WJ, ['target'=>'_blank']) ?></td>
    </tr>
    <?php } ?>
</table>

